import request from "@/utils/request";
import {LoginUser} from "@/common/interface/login.ts";
import {RegisterUser} from "@/common/interface/register.ts";

//登录
export function login(data: LoginUser) {
    return request({
        url: '/login',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 注册
export function register(data: RegisterUser) {
    return request({
        url: '/register',
        headers: {
            isToken: false
        },
        method: 'post',
        data: data
    })
}

// 获取注册角色列表
export function registerRoleList() {
    return request({
        url: '/unauth/register/role',
        method: 'get'
    })
}

// 根据字典类型查询字典数据列表
export function dictDataByDictType(dictType: string) {
    return request({
        url: '/unauth/dictData/' + dictType,
        method: 'get'
    })
}

// 获取用户信息
export function getUserInfo() {
    return request({
        url: '/getUserInfo',
        method: 'get'
    })
}

// 获取路由
export function getRouters() {
    return request({
        url: '/getRouters',
        method: 'get'
    })
}

// 退出
export function logout(data: any) {
    return request({
        url: '/logout',
        method: 'post',
        data: data
    })
}